﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 2.3.65    外访信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_COL_OUTSEE: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_COL_OUTSEE()
		{}
		#region Model
		private long _id;
		private string _empname;
		private long _empid;
		private Nullable<DateTime> _applydate;
		private Nullable<DateTime> _outdate;
		private int _outhour;
		private int _outsecond;
		private int _intradayback;
		private long _applyid;
		private string _custname;
		private long _chanid;
		private string _channame;
		private string _outtype;
		private string _detail;
		private Nullable<DateTime> _backdate;
		private string _signman;
		private int _isback;
		private int _status;
		private string _auditby;
		private Nullable<DateTime> _auditdate;
		private string _auditcontent;
		private int _auditresult;
		private int _signstatus;
		/// <summary>
		/// 记录ID唯一
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 员工姓名
		/// </summary>
		[DataMember]
		public string EMPNAME
		{
			get{return _empname;}
			set{
				if ( _empname!= value)
				{
					 _empname = value;
					OnPropertyChanged("EMPNAME");
				}
			}
		}
		/// <summary>
		/// 员工记录ID
		/// </summary>
		[DataMember]
		public long EMPID
		{
			get{return _empid;}
			set{
				if ( _empid!= value)
				{
					 _empid = value;
					OnPropertyChanged("EMPID");
				}
			}
		}
		/// <summary>
		/// 申请时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> APPLYDATE
		{
			get{return _applydate;}
			set{
				if ( _applydate!= value)
				{
					 _applydate = value;
					OnPropertyChanged("APPLYDATE");
				}
			}
		}
		/// <summary>
		/// 外出时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> OUTDATE
		{
			get{return _outdate;}
			set{
				if ( _outdate!= value)
				{
					 _outdate = value;
					OnPropertyChanged("OUTDATE");
				}
			}
		}
		/// <summary>
		/// 外出时间小时
		/// </summary>
		[DataMember]
		public int OUTHOUR
		{
			get{return _outhour;}
			set{
				if ( _outhour!= value)
				{
					 _outhour = value;
					OnPropertyChanged("OUTHOUR");
				}
			}
		}
		/// <summary>
		/// 外出时间分钟
		/// </summary>
		[DataMember]
		public int OUTSECOND
		{
			get{return _outsecond;}
			set{
				if ( _outsecond!= value)
				{
					 _outsecond = value;
					OnPropertyChanged("OUTSECOND");
				}
			}
		}
		/// <summary>
		/// 当天回公司0否，1是
		/// </summary>
		[DataMember]
		public int INTRADAYBACK
		{
			get{return _intradayback;}
			set{
				if ( _intradayback!= value)
				{
					 _intradayback = value;
					OnPropertyChanged("INTRADAYBACK");
				}
			}
		}
		/// <summary>
		/// 关联客户记录ID
		/// </summary>
		[DataMember]
		public long APPLYID
		{
			get{return _applyid;}
			set{
				if ( _applyid!= value)
				{
					 _applyid = value;
					OnPropertyChanged("APPLYID");
				}
			}
		}
		/// <summary>
		/// 关联客户名称
		/// </summary>
		[DataMember]
		public string CUSTNAME
		{
			get{return _custname;}
			set{
				if ( _custname!= value)
				{
					 _custname = value;
					OnPropertyChanged("CUSTNAME");
				}
			}
		}
		/// <summary>
		/// 关联渠道记录ID
		/// </summary>
		[DataMember]
		public long CHANID
		{
			get{return _chanid;}
			set{
				if ( _chanid!= value)
				{
					 _chanid = value;
					OnPropertyChanged("CHANID");
				}
			}
		}
		/// <summary>
		/// 关联渠道名称
		/// </summary>
		[DataMember]
		public string CHANNAME
		{
			get{return _channame;}
			set{
				if ( _channame!= value)
				{
					 _channame = value;
					OnPropertyChanged("CHANNAME");
				}
			}
		}
		/// <summary>
		/// 外出类型
		/// </summary>
		[DataMember]
		public string OUTTYPE
		{
			get{return _outtype;}
			set{
				if ( _outtype!= value)
				{
					 _outtype = value;
					OnPropertyChanged("OUTTYPE");
				}
			}
		}
		/// <summary>
		/// 情况说明
		/// </summary>
		[DataMember]
		public string DETAIL
		{
			get{return _detail;}
			set{
				if ( _detail!= value)
				{
					 _detail = value;
					OnPropertyChanged("DETAIL");
				}
			}
		}
		/// <summary>
		/// 登录回公司时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> BACKDATE
		{
			get{return _backdate;}
			set{
				if ( _backdate!= value)
				{
					 _backdate = value;
					OnPropertyChanged("BACKDATE");
				}
			}
		}
		/// <summary>
		/// 登记人
		/// </summary>
		[DataMember]
		public string SIGNMAN
		{
			get{return _signman;}
			set{
				if ( _signman!= value)
				{
					 _signman = value;
					OnPropertyChanged("SIGNMAN");
				}
			}
		}
		/// <summary>
		/// 是否回公司内登记0否，1是
		/// </summary>
		[DataMember]
		public int ISBACK
		{
			get{return _isback;}
			set{
				if ( _isback!= value)
				{
					 _isback = value;
					OnPropertyChanged("ISBACK");
				}
			}
		}
		/// <summary>
		/// 状态0保存，1提交
		/// </summary>
		[DataMember]
		public int STATUS
		{
			get{return _status;}
			set{
				if ( _status!= value)
				{
					 _status = value;
					OnPropertyChanged("STATUS");
				}
			}
		}
		/// <summary>
		/// 审批人
		/// </summary>
		[DataMember]
		public string AUDITBY
		{
			get{return _auditby;}
			set{
				if ( _auditby!= value)
				{
					 _auditby = value;
					OnPropertyChanged("AUDITBY");
				}
			}
		}
		/// <summary>
		/// 审批时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> AUDITDATE
		{
			get{return _auditdate;}
			set{
				if ( _auditdate!= value)
				{
					 _auditdate = value;
					OnPropertyChanged("AUDITDATE");
				}
			}
		}
		/// <summary>
		/// 审批意见
		/// </summary>
		[DataMember]
		public string AUDITCONTENT
		{
			get{return _auditcontent;}
			set{
				if ( _auditcontent!= value)
				{
					 _auditcontent = value;
					OnPropertyChanged("AUDITCONTENT");
				}
			}
		}
		/// <summary>
		/// 审批结论1同意，2拒绝
		/// </summary>
		[DataMember]
		public int AUDITRESULT
		{
			get{return _auditresult;}
			set{
				if ( _auditresult!= value)
				{
					 _auditresult = value;
					OnPropertyChanged("AUDITRESULT");
				}
			}
		}
		/// <summary>
		/// 确认登记状态0否，1是
		/// </summary>
		[DataMember]
		public int SIGNSTATUS
		{
			get{return _signstatus;}
			set{
				if ( _signstatus!= value)
				{
					 _signstatus = value;
					OnPropertyChanged("SIGNSTATUS");
				}
			}
		}
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

